//
//  ContentView.swift
//  SwiftUIDemo
//
//  Created by Kael on 2019/11/3.
//  Copyright © 2019 Kael. All rights reserved.
//

import SwiftUI


struct ContentView: View {
    @State var pageName : String = "测试页"
    var body: some View {
            VStack {
                
                LXNavBarView()
                    .background(Color.red)
                NavigationLink(destination:self.didSelectedText(item: 1) ) {
                    Text("hello -- SwiftUI")
                        .foregroundColor(.pink)
                        .padding(20)
                }
            
                TupleView<(Text, Text)>(
                (
                    Text("hello -- Kael ")
                        .font(.title),
                 
                    Text("hello -- Linda")
                        .font(.subheadline))
                
                )
                    .frame(width: 375, height: 64+24, alignment: .center)
                ExtractedView()

            }
            
       
    }
    func didSelectedText(item: Int) -> Text {
        Text("new text view")
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

struct ExtractedView: View {
    
    @State var wname : String = "-- Name --"
    
    var body: some View {
        List(0 ..< 5) { item in
            Text("hello--\(item)")
                .font(.title)
        }
    }
}

struct LXNavBarView: View {
    var body: some View {
        Group {
            
            HStack {
                Spacer()
                    .frame(width: 15, height: 10, alignment: .leading)
                
                Text("返回按钮")
                    .frame(width: 100, height: 30, alignment: .leading)
                Spacer()
                Text("导航条")
                .foregroundColor(Color(red: 1.0, green: 0.0, blue: 0.0, opacity: 1.0))
                .multilineTextAlignment(.center)
                Spacer()
                Text("right")
                    .frame(width: 100, height: 30, alignment: .trailing)
                Spacer()
                    .frame(width: 15, height: 10, alignment: .trailing)
            }
            .colorScheme(.light)
            
        }
    }
}
